<% if order.line_items.exists? %>
  <table class="line-items index" data-hook="line-items">
    <colgroup>
      <col style="width: 10%;" />
      <col style="width: 20%;" />
      <col style="width: 20%;" />
      <col style="width: 15%;" />
    </colgroup>

    <thead>
      <tr>
        <th colspan="2"><%= Spree::Product.human_attribute_name(:name) %></th>
        <th><%= Spree::LineItem.human_attribute_name(:price) %></th>
        <th><%= Spree::LineItem.human_attribute_name(:quantity) %></th>
        <th><%= Spree::LineItem.human_attribute_name(:total) %></th>
        <th class="orders-actions actions" data-hook="admin_order_form_line_items_header_actions">&nbsp;</th>
      </tr>
    </thead>

    <tbody>
      <% order.line_items.each do |item| %>
        <%= content_tag :tr, class: 'line-item', id: "line-item-#{item.id}", data: { line_item_id: item.id } do %>
          <td class="line-item-image"><%= image_tag item.variant.display_image.attachment(:mini) %></td>
          <td class="line-item-name">
            <%= item.variant.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
            <% if item.variant.sku.present? %>
              <strong><%= Spree::Variant.human_attribute_name(:sku) %>:</strong> <%= item.variant.sku %>
            <% end %>
          </td>
          <td class="line-item-price align-center"><%= item.single_money.to_html %></td>
          <td class="line-item-qty-show align-center">
            <%= item.quantity %>
          </td>
          <td class="line-item-qty-edit">
            <%= number_field_tag :quantity, item.quantity, :min => 0, :class => "line_item_quantity", :size => 5 %>
          </td>
          <td class="line-item-total align-center"><%= line_item_shipment_price(item, item.quantity) %></td>
          <td class="cart-line-item-delete actions" data-hook="cart_line_item_delete">
            <% if can? :update, item %>
              <%= link_to '', '#', :class => 'save-line-item fa fa-ok no-text with-tip',       :title => Spree.t('actions.save') %>
              <%= link_to '', '#', :class => 'cancel-line-item fa fa-cancel no-text with-tip', :title => Spree.t('actions.cancel') %>
              <%= link_to '', '#', :class => 'edit-line-item fa fa-edit no-text with-tip',     :title => Spree.t('actions.edit') %>
              <%= link_to '', '#', :class => 'delete-line-item fa fa-trash no-text with-tip',  :title => Spree.t('actions.delete') %>
            <% end %>
          </td>
        <% end %>
      <% end %>
    </tbody>
  </table>
<% end %>
